import datetime
import hashlib
import json

from bases.db import db
from bases.model import BaseMixins


class Permission(BaseMixins):
    """
    权限
    """
    __tablename__ = "auth_permission"
    __abstract__ = True

    name = db.Column(db.String, unique=True, nullable=False)
    description = db.Column(db.String)  # 描述
    value = db.Column(db.String, nullable=False)  # 权限值
    type = db.Column(db.Integer, nullable=False)  # 类型 1，菜单权限，2，接口权限
    t_created = db.Column(db.DateTime, default=datetime.datetime.now, comment='创建时间')
    t_modified = db.Column(db.DateTime, default=datetime.datetime.now, onupdate=datetime.datetime.now,
                           comment='修改时间')
